# http://www.securityfocus.com/infocus/1818
# http://www.openssl.org/docs/apps/req.html

#
# Crea el certificado y la clave que usara el cliente
openssl req -x509 -newkey rsa:1024 -keyout main.key -out main.cert
openssl rsa -in main.key -out main.rsa

openssl req -x509 -newkey rsa:1024 -keyout others.key -out others.cert
openssl rsa -in others.key -out others.rsa


if [ ! -d ./demoCA/newcerts ]
then
   mkdir -p ./demoCA/newcerts
   > ./demoCA/index.txt
   echo "01" > ./demoCA/serial
fi

#
# El nuevo certificado sera usado por el servidor y estara en ./demoCA/newcerts/<serial>.pem
#
openssl ca -cert main.cert -keyfile main.rsa -ss_cert others.cert -verbose
